#ifndef CONTACTSMODEL_H
#define CONTACTSMODEL_H

#include <QAbstractListModel>

class ContactInfo;

class ContactsModel : public QAbstractListModel
{
    Q_OBJECT
public:
    enum Roles {PictureRole = Qt::UserRole,
                PresenseRole, UnreadMessagesRole};
    explicit ContactsModel(QObject *parent = 0);
    ~ContactsModel();

    ContactInfo * addContact(const QString &id, const QString &networkId);
    ContactInfo * getContact(const QString &id, const QString &networkId) const;
    void removeContact(ContactInfo * item);

    int rowCount(const QModelIndex &parent) const;
    QModelIndex index(int row, int column, const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;

private slots:
    void contactChanged(ContactInfo * contact);

private:
    QList<ContactInfo *> m_contacts;

};

#endif // CONTACTSMODEL_H
